package com.jule.robot.strategy.impl;

import JoloProtobuf.GameSvr.JoloGame;
import com.jule.robot.service.holder.FunctionIdHolder;
import com.jule.robot.service.websocket.BaseWebSocketClient;
import com.jule.robot.strategy.BaseRobotStrategry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class IsAllowSideShowStrategry extends BaseRobotStrategry {
    private final static Logger logger = LoggerFactory.getLogger(IsAllowSideShowStrategry.class);

    public IsAllowSideShowStrategry() {
    }

    @Override
    public void doAction(BaseWebSocketClient client, int functionId, byte[] bytes) {
//        setClient(client);
        try {
            JoloGame.JoloGame_IsAllowSideShowAck ack = JoloGame.JoloGame_IsAllowSideShowAck.parseFrom(bytes);
            StringBuilder logStr = new StringBuilder();
            logStr.append("Ack_IsAllowSideShow Header, functionId->"+functionId+", functionName->"+ FunctionIdHolder.GetFunctionName(functionId)+", ACK Body, result->" + ack.getResult() + ", ResultMsg->" + ack.getResultMsg()
                    + ", userId->"+ack.getUserId()+", roomId->"+ack.getRoomId() +", tableId->"+ack.getTableId()+", gameOrderId->"+ack.getGameOrderId());
            if(ack.getResult() == 1){
                logStr.append(", isAllow->"+ack.getIsAllow()+", targetUserId->"+ack.getTargetUserId());
            }
            logger.info(logStr.toString());
        }catch (Exception ex){
            logger.error("Ack_IsAllowSideShow error, msg = "+ex.getMessage(), ex);
        }
    }
}

